package com.csc.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.csc.dao.AccountDao;
import com.csc.domain.Account;
import com.csc.domain.State;

@Service
public class AccountServiceImpl implements AccountService{
	
	@Autowired
	private AccountDao accountDao;


	// HoangHung
	public Account findAccountInfoByAccountInfoNumber(String accountNumber) {
		return accountDao.findAccountInfoByAccountInfoNumber(accountNumber);
	}

	// HoangHung
	public List<Account> getListAccountByIdCardActive(String idCardNumber) {
		return accountDao.getListAccountByIdCardActive(idCardNumber) ;
	}

	// HoangHung
	public List<Account> getAccountByAccountId(Integer accountId){
		return accountDao.getAccountByAccountId(accountId);
	}

	// HoangHung
	public List<Account> getAccountListByIdCardNumber(String idCardNumber){
		return accountDao.getAccountListByIdCardNumber(idCardNumber) ;
	}

	public Account findAccountInfoById(int accountId) {
		return accountDao.findAccountInfoById(accountId) ;
	}

	public State findStateById(int stateId) {
		return accountDao.findStateById(stateId);
	}

	public boolean updateAccount(Account account) {
		try {
			accountDao.updateAccount(account);
		} catch (Exception e) {
			return false;
		}
		return true;
	}
}

